CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/GitSHA1.cpp.in
                ${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp @ONLY)
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/global.hxx.in
                ${CMAKE_CURRENT_BINARY_DIR}/global.hxx @ONLY)
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/archs.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/archs.h @ONLY)

SET(FILES_H
    ${CMAKE_CURRENT_SOURCE_DIR}/ProgressHelper.h
    ${CMAKE_CURRENT_SOURCE_DIR}/LuminanceOptions.h)
SET(FILES_HXX
    ${CMAKE_CURRENT_SOURCE_DIR}/TranslatorManager.h
    ${CMAKE_CURRENT_SOURCE_DIR}/CommonFunctions.h
    ${CMAKE_CURRENT_SOURCE_DIR}/init_fftw.h)
SET(FILES_CPP
    ${CMAKE_CURRENT_SOURCE_DIR}/global.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/LuminanceOptions.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/ProgressHelper.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/CommonFunctions.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/TranslatorManager.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/init_fftw.cpp)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

QT5_WRAP_CPP(FILES_MOC ${FILES_H})

ADD_LIBRARY(common STATIC ${FILES_H} ${FILES_CPP} ${FILES_MOC} ${FILES_HXX}
    ${CMAKE_CURRENT_BINARY_DIR}/global.hxx
    ${CMAKE_CURRENT_BINARY_DIR}/config.h
    ${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp)

TARGET_LINK_LIBRARIES(common Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml)

SET(FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${FILES_CPP} ${FILES_H} ${FILES_HXX} PARENT_SCOPE)
SET(LUMINANCE_MODULES_GUI ${LUMINANCE_MODULES_GUI} common PARENT_SCOPE)
SET(LUMINANCE_MODULES_CLI ${LUMINANCE_MODULES_CLI} common PARENT_SCOPE)
